/*
 * Class2A.h
 *
 *  Created on: 2015年7月16日
 *      Author: Robot
 */

#ifndef CLASS2A_H_
#define CLASS2A_H_
#include "Class2.h"
//184 bits。
//<Header>-6bits
//<Class Type 2bit>-“10”
//<Segment type 4bit>-“0000”
//struct ST2A_Header{
//	unsigned char classType:2;
//	unsigned char segType:4;
//};
//
//<Synch. Info Class 2 >-25bits
//<SA_SIRFN_DELAY 4bit> – Delay of system information relative to superframe，见GMR-1 05.002
//<SA_BCCH_STN 5bit> – Binary representation of starting timeslot number，Range (0 - 23)，见 GMR-1 05.002
//<Superframe number 13bit> – Superframe number
//<Multiframe number 2bit> – Multiframe number in a superframe
//<MFFN 1bit> – TDMA FN in a multiframe
struct ST2A_SynchInfo{
	unsigned char SA_SIRFN_DELAY:4;
	unsigned char SA_BCCH_STN:5;
	unsigned short superframeNum :13;
	unsigned char multiframeNum:2;
	unsigned char MFFN:1;
};
//	<Selection Criteria Class 2> – 5 bits
struct  ST2A_SelectionCriteria{
	//	<C1 5bit> – Threshold to camp-on system in units of 0.5 dB，ranging from 0 - 15.5 dB
	unsigned char C1:5;
};
//	<Misc. Information Class 2> – 4 bits
struct  ST2A_MiscInfo{
	//	<SB_SELECTION_POWER 4bit> – In units of 0.5 dB. Valid range: 0 - 6.0 dB
	unsigned char SB_SELECTION_POWER:4;
};

//<LA Information Class 2> – 20 bits
//<SA_PCH_CONFIG 2bit> – Paging group configuration information
//<SA_BACH_CONFIG 8bit> – Alerting group configuration information
//<RACH_TS_OFFSET 5bit> – Start of RACH window with respect to BCCH (seeGMR-1 05.002), Value in the range 0 - 23
//<N_Page_Occurrences 2bit> – Number of times a page shall be retransmitted after the initial ransmission. Value of 0 indicates that the page shall be transmitted once and not subsequently
//<IMSI attach-detach ind 1bit> – ATT flag. Value 0 means MESs are not allowed to apply IMSI attach and detach procedure for this LA.Value 1 means MESs shall apply IMSI attach and detach procedure for this LA
//<ECSC indication 1bit> – Early Classmark Sending Control. This bit controls early sending of the classmark by the MES implementing "Controlled Early Classmark Sending"
//– 1 Early sending is explicitly accepted
//– 0 Early sending is explicitly prohibited
//<SI_update_ind 1bit> – Flag for BACH reorganization. Value changes after each reorganization

//	<Misc. Information Class 2> – 4 bits
struct  ST2A_LAInfo{
	unsigned char SA_PCH_CONFIG:2;
	unsigned char SA_BACH_CONFIG;
	unsigned char RACH_TS_OFFSET:5;
	unsigned char N_Page_Occurrences:2;
	unsigned char IMSI_attach_detach_ind:1;
	unsigned char ECSC_indication:1;
	unsigned char SI_update_ind:1;
};
//<BCCH NEIGHBOUR LIST1> – 57 bits (three BCCH neighbours=3*19)。
//周边6个临近波束中，包含前3个临近波束的BCCH信息。剩下的3个临近波束的BCCH信息在BCCH NEIGHBOUR
//LIST2中。
//<ARFCN 11bit>
//<SA_BCCH_STN 5bit>
//<RELATIVE_FRAME_OFFSET 3bit> – Frame number relative to the BCCH frame number of the centre beam
//<Spare: bitstring(64)> – 64 bits

struct  BCCH_NEIGHBOUR_LIST1{
	unsigned short ARFCN:11;
	unsigned char SA_BCCH_STN:5;
	unsigned char RELATIVE_FRAME_OFFSET:3;
};
class Class2A :public Class2{
public:
	Class2A();
	virtual ~Class2A();

//	ST2A_Header header;

	//	<Class 4 Version >-3bits 包含class 4 information的版本信息
	unsigned char class4Ver:3;
	ST2A_SynchInfo synchInfo;
	ST2A_SelectionCriteria selectionCriteria;
	ST2A_MiscInfo miscInfo;
	ST2A_LAInfo laInfo;
	BCCH_NEIGHBOUR_LIST1 BCCH_NEIGHBOUR_LIST[3];

	long spare;

};

#endif /* CLASS2A_H_ */
